package customexception;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025/5/13
 * Time: 00:42
 */

public class Login {
    public void login(String username, String password){
        if(!"admin".equals(username) ){
            throw new UsernameErrorException("用户名错误");
        }
        if(!"123456".equals(password)){
            throw new PasswordErrorException("密码错误");
        }
        System.out.println("登录成功");
    }

    public static void main(String[] args) {
        Login login = new Login();
        try {
            login.login("admin", "123456");
        }catch (UsernameErrorException | PasswordErrorException e){
            e.printStackTrace();
        }
        System.out.println("程序继续执行");
    }
}
